const get = (url, data={})=>{
  return new Promise(( resolve, reject ) => {
    if (!url) {  
      reject('No Url')  
      return  
    }
    $.ajax({
      url:url,
      type:'get',
      dataType:'JSON',
      data:data,
      success:res=>{
        resolve( res)  
      },
      error:err=>{
        reject(err)
      }
    })
  })
}
const post =(url, data={})=>{
  return new Promise(( resolve, reject ) => {
    if (!url) {  
      reject('No Url')
      return  
    }
    $.ajax({
      url:url,
      type:'post',
      dataType:'JSON',
      data:data,
      success:res=>{
        resolve( res)  
      },
      error:err=>{
        reject(err)
      }
    })
  })
}
export {get, post} 